import request from '@/utils/request';
import {object2Url} from "@/utils/trans";
//pc 头部head-title
// 获取代理入口二维码
export async function getOemCode () {
  const ts = new Date().getTime()
  const ua = navigator.userAgent
  const us = {
    ts,
    ua
  }
  let url = `/business/mobile/agent_index${object2Url(us)}`
  const res = await request.get(url, us)
  if (res.data.code === 2000) {
    return res.data.data
  }
  return Promise.reject(new Error(res.data.msg))
}

// 获取商家入口二维码
export async function getMerchantCode () {
  const ts = new Date().getTime()
  const ua = navigator.userAgent
  const us = {
    ts,
    ua
  }
  // eslint-disable-next-line no-undef
  let url = `/business/merchant_index${object2Url(us)}`
  const res = await request.get(url, us)
  if (res.data.code === 2000) {
    return res.data.data
  }
  return Promise.reject(new Error(res.data.msg))
}

